﻿<UserControl x:Class="Qplus.UI.RichTextControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" GotFocus="UserControl_GotFocus">

    <UserControl.Resources>
        <ControlTemplate x:Key="newTxt_notUse" TargetType="TextBox">
            <Grid x:Name="RootElement">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="MouseOver"/>
                        <VisualState x:Name="Disabled"/>
                        <VisualState x:Name="ReadOnly"/>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="FocusStates">
                        <VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="#5EC9C9C9"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Unfocused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="ValidationStates">
                        <VisualState x:Name="Valid"/>
                        <VisualState x:Name="InvalidUnfocused"/>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border x:Name="Border" BorderThickness="0">
                    <Grid>
                        <ScrollViewer x:Name="ContentElement" Margin="10 0" HorizontalAlignment="Left" VerticalAlignment="Center" BorderThickness="0" IsTabStop="False"/>
                    </Grid>
                </Border>
            </Grid>
        </ControlTemplate>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">
        <ScrollViewer Name="richTxtCtrlSV">
            <toolkit:WrapPanel Name="richTxtCtrlWP"
                               SizeChanged="richTxtCtrlWP_SizeChanged">
                <TextBox Name="firstTxt" VerticalContentAlignment="Center" Style="{StaticResource noBorderTB}"/>
            </toolkit:WrapPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
